package 地铁系统;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class TabDelimitedFileReader {
    public static void main(String[] args) {
        // 文件路径
        String filePath = "D:\\subway.txt"; // 替换为你的文件路径

        try (BufferedReader reader = new BufferedReader(new FileReader(filePath))) {
            String line;
            // 逐行读取文件
            while ((line = reader.readLine()) != null) {
                // 使用split方法以tab为分隔符分割每一行
                String[] fields = line.split("\t");
                // 输出每一行的各个字段
                for (String field : fields) {
                    System.out.print(field + " ");
                }
                System.out.println();
            }
        } catch (IOException e) {
            System.out.println("Error reading file: " + e.getMessage());
            e.printStackTrace();
        }
    }
}